using System.Windows;

namespace WPFPractice.Dialogs
{
	public class MaskDialogBase : Window
	{
		private readonly Window _parentWindow;

		public MaskDialogBase (Window parentWindow = null)
		{
			_parentWindow = parentWindow ?? Application.Current.MainWindow;
			Loaded += OnLoaded;
		}

		private void OnLoaded(object sender, RoutedEventArgs e)
		{
			if(_parentWindow != null)
			{
				Width = _parentWindow.ActualWidth;
				Height = _parentWindow.ActualHeight;
				Left = _parentWindow.Left;
				Top = _parentWindow.Top;

				if(_parentWindow.WindowState == WindowState.Maximized)
				{
					WindowState = WindowState.Maximized;
				}
			}
		}
	}
}
